#!/bin/bash
CPU_COUNT=`cat /proc/cpuinfo | grep processor | wc -l`

MEM_OPTS="-Xms256m -Xmx256m -XX:MetaspaceSize=64m -server"
LOG_CONFIG="-Dlog4j.configurationFile=config/log4j2.xml"
GC_OPTS="-XX:ParallelGCThreads=$CPU_COUNT -XX:SurvivorRatio=1  -XX:-UseAdaptiveSizePolicy -XX:+CMSClassUnloadingEnabled -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -verbose:gc -XX:+PrintGCTimeStamps -XX:+PrintGCDetails -Xloggc:logs/gc.log"


echo "JMX参数: "$JMX_OPTS
echo "log参数: "$LOG_CONFIG
echo "内存参数: "$MEM_OPTS
echo "垃圾收集参数: "$GC_OPTS
# 打印到startup.log
if [ ! -d logs ]; then  mkdir logs  ; fi
java $MEM_OPTS $LOG_CONFIG $CONFIG_INFO -jar lib/${project.build.finalName}.jar >> logs/start.out 2>&1 &

pid=$!
echo $pid>.pid
echo "${project.name} 启动成功"
